<template>
  <div class="report-form-content">
    <div class="tabs-form-head">
      <span>合同纠纷</span>
      <div class="">
        <el-button type="primary" plain @click="returnBtn">返回</el-button>
      </div>
    </div>
    <el-divider border-style="dashed" />
    <el-row :gutter="20">
      <el-col :sm="24" :lg="24" style="padding-left: 20px" v-if="objList.length === 0">
        <el-card class="update-log">
          <el-empty :image-size="100" />
        </el-card>
      </el-col>
      <el-col :sm="24" :lg="24" style="padding-left: 20px" v-else>
        <el-card class="update-log">
          <div class="report-form-list-content-1">
            <div class="report-list">
              <span>合同纠纷原因：</span>
              <span>{{ obj.disputeReason }}</span>
            </div>
          </div>
          <div class="report-form-list-content-1">
            <div class="report-list">
              <span>对方意见：</span>
              <span>{{ obj.disputeSecond }}</span>
            </div>
          </div>
          <div class="report-form-list-content">
            <div class="report-list">
              <span>对方意见记录时间：</span>
              <span>{{ obj.disputeSecondTime }}</span>
            </div>
          </div>
          <div class="report-form-list-content-1">
            <div class="report-list">
              <span>我方意见：</span>
              <span>{{ obj.disputeFirst }}</span>
            </div>
          </div>
          <div class="report-form-list-content">
            <div class="report-list">
              <span>我方意见记录时间：</span>
              <span>{{ obj.disputeFirstTime }}</span>
            </div>
          </div>
          <div class="report-form-list-content-1">
            <div class="report-list">
              <span>处理结果：</span>
              <span>{{ obj.disputeResult }}</span>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>
<script setup>
import {ref, getCurrentInstance} from 'vue'
import {doGet} from "@/config/http";
import {svc} from "@/config/common";
import { useRoute, useRouter } from 'vue-router'

const router = useRouter()
const route = useRoute()

const { proxy: ctx } = getCurrentInstance();

let obj = ref({
  batch: '', // 批次号
  contractInitialId: route.query.id, // 合同ID
  createBy: '',	// 创建人用户ID
  createTime: '', // 创建时间
  disputeFirst: '', // 	我方意见
  disputeFirstTime: '', // 我方意见记录时间
  disputeReason: '', // 合同纠纷原因
  disputeResult: '', // 处理结果
  disputeSecond: '', // 对方意见
  disputeSecondTime: '', // 对方意见记录时间
  id: '', // 主键ID
})

let objList = ref([])

const initObj = async () =>  {
  if (route.query.id) {
    objList.value = await doGet(svc, '/contract-initial-dispute/listByField', {field: 'contractInitialId', values: route.query.id}, true)
    if (objList.value.length > 0) {
      obj.value = objList.value[0]
      console.log('obj.value',obj.value)
    }
  }
}

initObj()

const returnBtn = () => {
  switch (route.query.kind) {
    case '1':
      ctx.goTargetByName('contractInitial', {});
      break;
    case '2':
      ctx.goTargetByName('contractMain', {})
      break;
  }
}
</script>
<style scoped>
.report-form-content {
  padding: 20px;
}
.update-log {
  width: 100%;
  margin: 30px 0;
}
.report-list {
  width: 31%;
  margin: 15px;
  display: flex;
  align-items: center;
}
.report-list span:nth-child(1) {
  display: inline-block;
  width: 120px;
  text-align: right;
}
.tabs-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tabs-form-head span {
  font-size: 18px;
  color: #303133;
  font-weight: bold;
}
.report-list {
  width: 31%;
  margin: 15px;
  display: flex;
  align-items: center;
}
.report-list span:nth-child(1) {
  display: inline-block;
  width: 150px;
  text-align: right;
}
</style>
